************************************************
*DoFile for Figures and Tables in Paper and Appendix
************************************************

************************************************Main Results
use "replicationdata.dta", clear

************************************************
*Table 1
*Model 1
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year, cluster(yrstdistrepspec)  
*Model 2
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year<2000, cluster(yrstdistrepspec)  
*Model 3
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year>1998, cluster(yrstdistrepspec)  
*Model 4
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 i.openseat ///
	i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  

************************************************
*Figure 1a
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  
qui margins, atmeans at(ratio_maxfirstreport=(0(.1)1) qual=(1 0) post2000=0 openseat=1 challengerparty=0 partybalance=2 gender=0 rep==1)
marginsplot,  scheme(s1manual) recast(line) recastci(rarea) plot1opts(msize(small) ///
	mcolor(gs11) lcolor(black) lpattern(solid) msymbol(dot)) ///
	plot2opts(msize(small) mcolor(gs4) lcolor(gs4) lpattern(solid) msymbol(dot)) ///
	ci1opts(color(gs12)) ci2opts(color(gs7))  xlabel(0(.2)1, labsize(medlarge)) ylabel(0(.1).4, ///
	labsize(medlarge) angle(0)) ytitle("Probability of Exit", size(medlarge)) ///
	xtitle("Early Fundraising Share", size(medlarge)) title(" ") ///
	legend(order(2 "Experienced" 1 "Inexperienced") ///
	region(lstyle(none) lcolor(white))) plotregion(color(white) lcolor(white)) graphregion(color(white))

*Figure 1b
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  
qui margins, atmeans at(ratio_maxfirstreport=(0(.1)1) qual=(1 0) post2000=1 openseat=1 challengerparty=0 partybalance=2 gender=0 rep==1)
marginsplot,  scheme(s1manual) recast(line) recastci(rarea) plot1opts(msize(small) mcolor(gs11) lcolor(black) lpattern(solid) msymbol(dot)) ///
	plot2opts(msize(small) mcolor(gs4) lcolor(gs4) lpattern(solid) msymbol(dot)) ///
	ci1opts(color(gs12)) ci2opts(color(gs7))  xlabel(0(.2)1, labsize(medlarge)) ylabel(0(.1).4, ///
	labsize(medlarge) angle(0)) ytitle("Probability of Exit", size(medlarge)) ///
	xtitle("Early Fundraising Share", size(medlarge)) title(" ") ///
	legend(order(2 "Experienced" 1 "Inexperienced") ///
	region(lstyle(none) lcolor(white))) plotregion(color(white) lcolor(white)) graphregion(color(white))

************************************************
*Table 2
*Model 1
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if nochange==1, cluster(yrstdistrepspec)  
*Model 2
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if nochange!=1, cluster(yrstdistrepspec)  
*Model 3
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if nochangefiling==1, cluster(yrstdistrepspec)  
*Model 4
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if nochangefiling==0, cluster(yrstdistrepspec)  	

*Predicted values 
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  
margins, atmeans at(ratio_maxfirstreport=(.20) qual=(1) post2000=(0 1) openseat=1 challengerparty=0 partybalance=2 gender=0 rep==1)
margins, atmeans at(ratio_maxfirstreport=(.20) qual=(0) post2000=(0 1) openseat=1 challengerparty=0 partybalance=2 gender=0 rep==1)
margins, dydx(ratio_maxfirstreport) atmeans at(qual=(1) post2000=(0 1) openseat=1 challengerparty=0 partybalance=2 gender=0 rep==1)
margins, dydx(ratio_maxfirstreport) atmeans at(qual=(0) post2000=(0 1) openseat=1 challengerparty=0 partybalance=2 gender=0 rep==1)

************************************************Early Money vs. Career Incentives
use "statelegs.dta", clear

************************************************
*Table 3
*Model 1
logit dropout i.upforrelect ratio_maxfirstreport i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep 
*Model 2
logit dropout i.upforrelect ratio_maxfirstreport i.openseat i.partybalance i.openseat#3.partybalance i.challengerparty ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep if totalfirstreport_adj_hundthou<1.1111
margins, atmeans at(upforrelect=(0 1) gender=0 rep=1 openseat=1 partybalance=2 challengerparty=0)
*Model 3
logit dropout i.upforrelect ratio_maxfirstreport i.openseat i.partybalance i.openseat#3.partybalance i.challengerparty ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep if totalfirstreport_adj_hundthou>=1.1111
margins, atmeans at(upforrelect=(0 1) gender=0 rep=1 openseat=1 partybalance=2 challengerparty=0)

*Predicted values
logit dropout i.upforrelect ratio_maxfirstreport i.openseat i.partybalance i.openseat#3.partybalance i.challengerparty ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep if totalfirstreport_adj_hundthou<1.1111
margins, atmeans at(upforrelect=(0 1) gender=0 rep=1 openseat=1 partybalance=2 challengerparty=0)

logit dropout i.upforrelect ratio_maxfirstreport i.openseat i.partybalance i.openseat#3.partybalance i.challengerparty ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep if totalfirstreport_adj_hundthou>=1.1111
margins, atmeans at(upforrelect=(0 1) gender=0 rep=1 openseat=1 partybalance=2 challengerparty=0)
  
*Descriptive differences between dropouts and non-dropouts on other metrics (SLES, leadership, committee chair, power committee, seniority, unopposed)
ttest SLES if ratio_maxfirstreport!=., by(dropout)
ttest SLES_median if ratio_maxfirstreport!=., by(dropout)
ttest expectation if ratio_maxfirstreport!=., by(dropout)
ttest leader if ratio_maxfirstreport!=., by(dropout)
ttest comm_chair if ratio_maxfirstreport!=., by(dropout)
ttest power_comm if ratio_maxfirstreport!=., by(dropout)
ttest seniority if ratio_maxfirstreport!=., by(dropout)
ttest stateleg_genuo, by(dropout)

************************************************Implications for competition
use "competition.dta", clear

************************************************
*Table 4
*Model 1
logit competitiveprivotes_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 
*Model 2
logit competitiveprireceipts_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 
*Model 3
logit competitiveprivotes_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 & maxqualonballot==1
*Model 4
logit competitiveprireceipts_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 & maxqualonballot==1

*Predicted values
logit competitiveprivotes_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 
margins, at(totalqualonballot=(1(1)4) openseat=1)
logit competitiveprireceipts_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 
margins, at(totalqualonballot=(1(1)4) openseat=1)

************************************************
*Figure 2a	
logit competitiveprivotes_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 
qui margins, at(totalqualonballot=(0(1)4) openseat=1)
marginsplot, recast(scatter) plot1opts(lcolor(black) mcolor(black) lwidth(med)) ///
	ci1opts(color(black)) yscale(range(0 .4)) ylabel(0(.2)1, labsize(medlarge) angle(0)) ytitle("P(Competitive), Votes", size(large)) ///
	yscale(titlegap(2.5)) title("", color(black) size(vlarge) margin(b=3) bexpand nospan) ///
	xscale(range(-.3 4.3)) xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4+ ", labsize(medlarge) angle(0)) ///
	xtitle("Experienced Candidates on the Ballot", size(medlarge)) ///
	xscale(titlegap(2.5)) graphregion(color(white)) legend(off)

*Figure 2b
logit competitiveprireceipts_575 i.totalqualonballot i.openseat##i.partybalance if hopeless!=1 & incumcontested==0 
qui margins, at(totalqualonballot=(0(1)4) openseat=1)
marginsplot, recast(scatter) plot1opts(lcolor(black) mcolor(black) lwidth(med)) ///
	ci1opts(color(black)) yscale(range(0 .4)) ylabel(0(.2)1, labsize(medlarge) angle(0)) ytitle("P(Competitive), Receipts", size(large)) ///
	yscale(titlegap(2.5)) title("", color(black) size(vlarge) margin(b=3) bexpand nospan) ///
	xscale(range(-.3 4.3)) xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4+ ", labsize(medlarge) angle(0)) ///
	xtitle("Experienced Candidates on the Ballot", size(medlarge)) ///
	xscale(titlegap(2.5)) graphregion(color(white)) legend(off)

************************************************
*Figure 3a
histogram totalqualonballot if maxqualdropout==1 & hopeless!=1 & incumcontested==0, percent discrete ///
	bcolor(gs12) barwidth(.6) xtitle("Experienced Candidates on the Ballot", size(medlarge))  ///
	yscale(titlegap(2)) yscale(range(0 40)) ylabel(0(10)40, labsize(medlarge) angle(0)) ylabel(,format(%6.0fc)) ///
	xscale(range(0 4.7))  xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4+ ", labsize(medlarge) angle(0)) ///
	ytitle("Percent of Primaries" , size(large)) xscale(titlegap(2.5))  ///
	title("", color(black) size(vlarge) bexpand nospan) ///
	graphregion(color(white)) legend(off) 

*Figure 3b
histogram totalqualonballot if maxqualdropout==1 & hopeless!=1 & openseat==1, percent discrete ///
	bcolor(gs12) barwidth(.6) xtitle("Experienced Candidates on the Ballot", size(medlarge)) ///
	yscale(titlegap(2)) yscale(range(0 40)) ylabel(0(10)40, labsize(medlarge) angle(0)) ylabel(,format(%6.0fc)) ///
	xscale(range(0 4.7))  xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4+ ", labsize(medlarge) angle(0)) ///
	ytitle("Percent of Primaries" , size(large)) xscale(titlegap(2.5))  ///
	title("", color(black) size(vlarge) bexpand nospan) ///
	graphregion(color(white)) legend(off) 

tab totalqualonballot if maxqualdropout==1 & hopeless!=1 & incumcontested==0
tab totalqualonballot if maxqualdropout==1 & hopeless!=1 & openseat==1

************************************************Appendix Figures
use "totalsbyyear.dta"

************************************************
*Figure A1
twoway line totalcand_onballot year, color(black) lwidth(medthick) || ///
	line totalcand_all year, color(black) lwidth(medthick) lpattern(dash) ///
	plotregion(color(white)) plotregion(lcolor(black)) graphregion(color(white)) ///
	ytitle("Number of Nonincumbents", size(medlarge)) yscale(titlegap(2)) yscale(range(600 2000)) ylabel(500(500)2000, ///
	labsize(medium) angle(0) format(%6.0fc)) ///
	xscale(range(1979.5 2022.5)) xlabel(1980(4)2020, labsize(medsmall) angle(0)) xtitle("") graphregion(color(white)) ///
	legend(order(1 "Nonincumbents on Primary Ballot" 2 "Nonincumbents Including Dropouts"))  ///
	legend(cols(1)) legend(region(lwidth(none))) plotregion(color(white) lcolor(white)) graphregion(color(white))

************************************************
*Figure A2
twoway line totalqualcand_onballot year, color(black) lwidth(medthick) || ///
	line totalqualcand_all year, color(black) lwidth(medthick) lpattern(dash) ///
	plotregion(color(white)) plotregion(lcolor(black)) graphregion(color(white)) ///
	ytitle("Number of Candidates", size(medlarge)) yscale(titlegap(2)) yscale(range(0 450)) ylabel(0(100)450, labsize(medium) angle(0)) ///
	xscale(range(1979.5 2022.5)) xlabel(1980(4)2020, labsize(medsmall) angle(0)) xtitle("") graphregion(color(white)) ///
	legend(order(1 "Experienced Nonincumbents on Primary Ballot" 2 "Experienced Nonincumbents Including Dropouts"))  ///
	legend(cols(1)) legend(region(lwidth(none))) plotregion(color(white) lcolor(white)) graphregion(color(white))

************************************************
*Figure A3
twoway line sumdropout year, yaxis(1) ytitle("Number of Dropouts", size(medlarge)) ///
	yscale(titlegap(1) axis(1)) color(black) lwidth(medthick) ||  ///
	line propdropoutnoninc year, yaxis(2) ytitle("Proportion of Nonincumbents", ///
	size(medlarge) axis(2)) yscale(titlegap(1) axis(2)) color(black) lwidth(medthick) lpattern(dash) ///
	plotregion(color(white)) plotregion(lcolor(black)) graphregion(color(white)) ///
	yscale(range(0 350)) ylabel(0(50)350, labsize(medium) angle(0)) ylabel(0(.05).2, labsize(medium) angle(0) axis(2)) ///
	xscale(range(1979 2023)) xlabel(1980(4)2020, labsize(medsmall) angle(0)) xtitle("") graphregion(color(white)) ///
	legend(order(1 "Number of Dropouts" 2 "Proportion of Nonincumbents"))  legend(cols(1)) ///
	legend(region(lwidth(none))) plotregion(color(white) lcolor(white)) graphregion(color(white))

************************************************State Ballot Filing Dates
use "statedeadlines.dta", clear

************************************************
*Figure A5
twoway line Pelect_month year, lcolor(black) sort by(state,cols(5) note("") ///
	graphregion(fcolor(white)) plotregion(fcolor(white)) graphregion(color(white)))  ///
	subtitle(, fcolor(white) lcol(black)) title("", size(large) color(black) margin(b=3) bexpand nospan) ///
	ytitle("Primary Election Month", size(small)) legend(off) ///
	xtitle(" ", size(small)) xscale(range(1979.5 2022.5)) xlabel(1980(10)2020, labsize(medium)) ///
	yscale(range(2 11)) yscale(titlegap(2)) ylabel(3(3)9, angle(0) labsize(medium))  

************************************************
*Figure A6
twoway line Pfiling_timing year if Pfiling_timing<150, sort by(state,cols(5) ///
	note("") graphregion(fcolor(white)) plotregion(fcolor(white)) graphregion(color(white)))  ///
	subtitle(, fcolor(white) lcol(black)) title("", size(large) color(black) margin(b=3) bexpand nospan) ///
	ytitle("Filing Deadline" "(Days Before Primary)", size(small)) legend(off) ///
	xtitle(" ", size(small)) xscale(range(1983.5 2022.5)) xlabel(1990(10)2020, labsize(medium)) ///
	yscale(range(25 151)) yscale(titlegap(2)) ylabel(30(50)150, angle(0) labsize(medium))  

************************************************Appendix Tables
use "replicationdata.dta", clear

************************************************
*Table A1
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year, cluster(yrstdistrepspec) 
eststo clear   
estpost tabstat dropout qual ratio_maxfirstreport openseat challengerparty partybalance prepriendorse Pelect_month nstatelegs2 npricands gender rep if e(sample), c(stat) stat(mean p50 sd min max) 

************************************************	
*Table A2
logit dropout c.ratio_sumfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum ///
	if ratio_maxfirstreport!=., cluster(yrstdistrepspec)  
logit dropout c.totalfirstreport_adj_hundthou##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month  nstatelegs2 npricands i.gender i.rep i.year i.statenum ///
	if ratio_maxfirstreport!=., cluster(yrstdistrepspec)  
logit dropout c.ratio_90day##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)  
	
************************************************	
*Table A3
logit dropout i.qual##i.abovethreshold i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)  
logit dropout i.qual##i.abovethreshold i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year<2000, cluster(yrstdistrepspec)  
logit dropout i.qual##i.abovethreshold i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year>1998, cluster(yrstdistrepspec)  
logit dropout i.qual##i.abovethreshold i.post2000#i.abovethreshold i.post2000 i.openseat ///
	i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  

************************************************	
*Table A4
logit dropout c.ratio_maxfirstreport##i.qual shareloan i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual shareloan i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year<2000, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual shareloan i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year>1998, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 shareloan i.openseat i.challengerparty ///
	i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  

************************************************	
*Table A5
logit dropout c.ratio_maxfirstreport##i.qual sharepac i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual sharepac i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year<2000, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual sharepac i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year>1998, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 sharepac i.openseat i.challengerparty ///
	i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  

************************************************	
*Table A6	
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if year<1996, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if year>1994 & year<2004, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if year>2002 & year<2012, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if year>2010, cluster(yrstdistrepspec)  

************************************************	
*Table A7
logit dropout c.ratio_maxfirstreport i.qual c.ratio_maxfirstreport#i.decade ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.decade ///
	i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  

************************************************	
*Table A8
logit dropout i.qual##c.ratio_maxfirstreport i.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if openseat==1 & year<2000, cluster(yrstdistrepspec) 
logit dropout i.qual##c.ratio_maxfirstreport i.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if openseat==1 & year>1998, cluster(yrstdistrepspec) 
logit dropout i.qual##c.ratio_maxfirstreport i.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if challengerparty==1, cluster(yrstdistrepspec) 
logit dropout i.qual##c.ratio_maxfirstreport i.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if incumcontested==1, cluster(yrstdistrepspec) 

************************************************	
*Table A9
logit dropout c.ratio_maxfirstreport##i.stateleg i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.stateleg i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if year<2000, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.stateleg i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if year>1998, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.stateleg c.ratio_maxfirstreport#i.post2000 i.post2000 i.openseat ///
	i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec)  

************************************************	
*Table A10
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if nomoney!=1, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year<2000 & nomoney!=1, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year>1998 & nomoney!=1, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 i.openseat ///
	i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if nomoney!=1, cluster(yrstdistrepspec)  

************************************************	
*Table A11
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if dropout_raiseoneqtr!=1, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year<2000 & dropout_raiseoneqtr!=1, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum i.year if year>1998 & dropout_raiseoneqtr!=1, cluster(yrstdistrepspec)  
logit dropout c.ratio_maxfirstreport##i.qual c.ratio_maxfirstreport#i.post2000 i.post2000 i.openseat ///
	i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum if dropout_raiseoneqtr!=1, cluster(yrstdistrepspec)  

************************************************	
*Table A12
logit dropout i.qual ratio_maxfirstreport totalpartydistrictdonors100 i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec) 
logit dropout c.ratio_maxfirstreport##i.qual totalpartydistrictdonors100 i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)  

************************************************	
*Table A13
logit dropout i.qual ratio_maxfirstreport i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum, cluster(yrstdistrepspec)
logit dropout i.qual ratio_maxfirstreport i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance   ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if year<2000, cluster(yrstdistrepspec) 
logit dropout i.qual ratio_maxfirstreport i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance  ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.year i.statenum if year>1998, cluster(yrstdistrepspec) 
logit dropout i.qual c.ratio_maxfirstreport##i.post2000 i.openseat i.challengerparty i.partybalance i.openseat#3.partybalance  ///
	prepriendorse Pelect_month nstatelegs2 npricands i.gender i.rep i.statenum, cluster(yrstdistrepspec) 

************************************************
*END
************************************************
